package com.sky.mapper;

import com.sky.annotation.AutoFill;
import com.sky.entity.Setmeal;
import com.sky.entity.SetmealDish;
import com.sky.enumeration.OperationType;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface SetMealDishMapper {
    /**
     * 根据菜品ID查询套餐
     * @param dishIds 菜品ID集合
     * @return 套餐ID集合
     */
    List<Long> selectSetmealByDishID(List<Long> dishIds);

    /**
     * 根据套餐ID删除菜品
     * @param setMealIds
     */
    void deleteBySetmealId(List<Long> setMealIds);

    /**
     * 更新套餐菜品信息
     * @param setMeal 套餐对象
     */
    @AutoFill(value = OperationType.UPDATE)
    void update(Setmeal setMeal);

    /**
     * 根据套餐ID查询套餐菜品信息
     * @return 套餐菜品信息集合
     */
    @Select("select * from setmeal_dish where setmeal_id = #{setMealId}")
    List<SetmealDish> selectSetmealDishBySetmealId(Long setMealId);

    /**
     * 插入套餐菜品信息
     * @param setmealDish
     */
    void insert(SetmealDish setmealDish);

    /**
     * 根据套餐ID删除菜品信息
     * @param id 套餐ID
     */
    @Delete("delete from setmeal_dish where setmeal_id = #{id}")
    void deleteBySetmealId1(Long id);
}
